package com.sinog.biz.service.business.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sinog.biz.mapper.havexml.PrisonerSrMapper;
import com.sinog.biz.mapper.noxml.AbPrisonerSrMapper;
import com.sinog.biz.service.business.ShgxParentOtherMainService;
import com.sinog.core.domain.AbPrisonersSrResultVo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @desc 获取社会关系父母列表
 * @author sunsf
 * @date 2020-02-07-16:40
 */
@Service
public class ShgxParentOtherMainServiceImpl extends ServiceImpl<AbPrisonerSrMapper,AbPrisonersSrResultVo> implements ShgxParentOtherMainService {

    @Resource
    private PrisonerSrMapper prisonerSrMapper;

    /**
     * 获取社会关系父母列表
     * @param priNum 罪犯编号
     * @return List<Map < String,String>>
     */
    @Override
    public List<Map<String,String>> getShgxParentList(String priNum) {
        List<Map<String,Object>> list = prisonerSrMapper.getShgxParentList(priNum);
        List<Map<String,String>> reList = new ArrayList<>(16);
        for(Map<String,Object> map : list) {
            Map<String,String> reMap = new HashMap<>(16);
            String id = map.get("id").toString();
            String name = null == map.get("name") ? "" : map.get("name").toString();
            String relation = null == map.get("relation") ? "" : map.get("relation").toString();
            String age = null == map.get("age") ? "" : map.get("age").toString();
            String danwei = null == map.get("danwei") ? "" : map.get("danwei").toString();
            String addr = null == map.get("addr") ? "" : map.get("addr").toString();
            String tel = null == map.get("tel") ? "" : map.get("tel").toString();
            String phone = null == map.get("phone") ? "" : map.get("phone").toString();
            //---------------帮教对象信息管理---查看----社会关系----by pzc -----2022-07-29--start
            reMap.put("id",id);
            reMap.put("name",name);
            reMap.put("relation",relation);
            reMap.put("age",age);
            reMap.put("danwei",danwei);
            reMap.put("addr",addr);
            reMap.put("tel", tel);
            reMap.put("phone",phone);
            //---------------帮教对象信息管理---查看----社会关系----by pzc -----2022-07-29--end
            reList.add(reMap);
        }
        return reList;
    }
}